/* eslint-disable no-shadow */
const base = 'cbv.chartered';
export function count({ search }) {
  return RSocket.rr({
    route: `${base}.count`,
    args: { search },
  });
}

export function search({ search, pg }) {
  return RSocket.rs({
    route: `${base}`,
    args: { search, pg },
  });
}

export function get(id) {
  return RSocket.rr({
    route: `${base}.${id}`,
  });
}

export function update(order) {
  return RSocket.rr({
    route: `${base}.update`,
    data: order,
  });
}

export function idDelete(id) {
  return RSocket.rr({
    route: `${base}.${id}.delete`,
  });
}

export function getDict(id) {
  return RSocket.rs({
    route: `dicts.${id}.items.top`,
    args: {
      pg: {
        size: 999,
      },
    },
  });
}

export function getLogs(search) {
  return RSocket.rs({
    route: 'logs',
    args: {
      search,
      pg: { page: 0, size: 100, sort: ['ts;desc'] },
    },
  });
}
